package ui.views;

import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.ui.views.properties.IPropertySheetPage;
import org.eclipse.ui.views.properties.PropertySheet;
import org.eclipse.ui.views.properties.tabbed.ISection;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;

import ui.util.IStructuredViewer;

public abstract class TabbedPropertyView extends PropertySheet implements
		IStructuredViewer {
	private TableViewer tableViewer;

	@Override
	public TableViewer getTableViewer() {
		try{
		PropertySheet propSheet = (PropertySheet) getSite().getPart();
		TabbedPropertySheetPage propPage = (TabbedPropertySheetPage) propSheet
				.getAdapter(IPropertySheetPage.class);
		for (ISection section : propPage.getCurrentTab().getSections()) {
			if (section instanceof IStructuredViewer) {
				tableViewer = ((IStructuredViewer) section).getTableViewer();
				return tableViewer;
			}
		}
		}catch(Exception e){
			return null;
		}

		return null;
	}

	@Override
	public TreeViewer getTreeViewer() {
		return null;
	}

}
